package com.eg.httpdownload;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class HttpDownload {
	
	public String DownloadTXT(String s){
		StringBuilder strBuilder = new StringBuilder();
		try {
			String line = null;
			URL url = new URL(s);
			HttpURLConnection uConn = (HttpURLConnection) url.openConnection();
			BufferedReader br = new BufferedReader(new InputStreamReader(uConn.getInputStream()));
			while((line=br.readLine()) != null){
				strBuilder.append(line);
			}
			
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return strBuilder.toString();
	}
}
